//
//  MYGCaseFilesDetailCell.swift
//  MYGrow
//
//  Created by 小火科技 on 2024/4/10.
//

import UIKit

class MYGCaseFilesSelectCell: UITableViewCell {

    var model:MYGCaseClasmListModel?{
        didSet {
            guard let data = model else {return}
            hospitalLabel.text = data.outpatient.time
            doctorLabel.text = "诊断: \(data.outpatient.info ?? "")"
            if data.module.count == 0{
                infoLabel.text = data.outpatient.hospital
                centerLabel.text = "医生:\(data.outpatient.doctor)"
            }else{
                infoLabel.text = data.module
            }
        }
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        initUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func initUI(){
        contentView.backgroundColor = .white
        
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.left.equalToSuperview().offset(54)
            make.height.width.equalTo(7.5)
        }
        
        contentView.addSubview(line)
        line.snp.makeConstraints { make in
            make.centerX.equalTo(titleLabel)
            make.top.equalTo(titleLabel.snp.bottom)
            make.bottom.equalToSuperview()
            make.width.equalTo(1)
        }
        
        contentView.addSubview(selectBtn)
        selectBtn.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(20)
            make.centerY.equalToSuperview()
            make.height.width.equalTo(15)
        }
        
        contentView.addSubview(hospitalLabel)
        hospitalLabel.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(76)
            make.top.equalToSuperview()
            make.right.equalToSuperview()
            make.height.equalTo(18.5)
        }
        
        contentView.addSubview(infoLabel)
        infoLabel.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(76)
            make.top.equalTo(hospitalLabel.snp.bottom).offset(10)
            make.right.equalToSuperview()
            make.height.equalTo(21)
        }
        contentView.addSubview(centerLabel)
        centerLabel.snp.makeConstraints { make in
            make.left.equalTo(infoLabel.snp.right).offset(10)
            make.centerY.equalTo(infoLabel)
            make.height.equalTo(18)
        }
        contentView.addSubview(doctorLabel)
        doctorLabel.snp.makeConstraints { make in
            make.left.equalToSuperview().offset(76)
            make.top.equalTo(infoLabel.snp.bottom).offset(10)
            make.height.equalTo(16.5)
        }
        
        
    }

    private lazy var titleLabel:UILabel = {
       let cont = UILabel()
//        cont.font = .medium(12)
//        cont.textAlignment = .center
//        cont.textColor = .rgba(255, 255, 255, 1)
//        cont.text = "18"
        cont.backgroundColor = .rgba(174, 174, 174, 1)
        cont.layer.cornerRadius = 3.75
        cont.layer.masksToBounds = true
        return cont
    }()
    
    private lazy var line:UIView = {
        let line = UIView()
        line.backgroundColor = .rgba(238, 238, 238, 1)
        return line
    }()
    
//    var bgView:UIView = {
//       let cont = UIView()
//        cont.backgroundColor = .white
//        cont.layerCornerRadius = SCALEWIDTH(6)
//        cont.layer.shadowColor = RGBA(r: 0, g: 0, b: 0, a: 0.1).cgColor
//        cont.layer.shadowOffset = CGSize(width: 0, height: 1)
//        cont.layer.shadowRadius = 13
//        cont.layer.shadowOpacity = 1
//        cont.layer.masksToBounds = false
//        return cont
//    }()
    lazy var selectBtn: UIButton = {
        let cont = UIButton()
        cont.setBackgroundImage(UIImage(named: "MYG_cloudDisk_content_normal"), for: .normal)
        cont.setBackgroundImage(UIImage(named: "MYG_cloudDisk_content_selected"), for: .selected)
        return cont
    }()
    
    private lazy var hospitalLabel:UILabel = {
       let cont = UILabel()
        cont.font = .regular(13)
        cont.textColor = .rgba(110, 110, 110, 1)
        cont.text = ""
        return cont
    }()
    private lazy var infoLabel:UILabel = {
       let cont = UILabel()
        cont.font = .medium(15)
        cont.textColor = .rgba(70, 70, 70, 1)
        return cont
    }()
    private lazy var doctorLabel:UILabel = {
       let cont = UILabel()
        cont.font = .regular(12)
        cont.textColor = .rgba(152, 152, 152, 1)
        return cont
    }()
    private lazy var centerLabel:UILabel = {
       let cont = UILabel()
        cont.font = .regular(12)
        cont.textColor = .rgba(152, 152, 152, 1)
        return cont
    }()
}
